package io.kiki.sba.registry.server.clientInterface.remoting.handler;

import io.kiki.sba.registry.api.Channel;
import io.kiki.sba.registry.core.model.ConfiguratorRegister;
import io.kiki.sba.registry.core.model.RegisterResponse;
import io.kiki.sba.registry.server.clientInterface.strategy.WatcherHandlerStrategy;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.concurrent.Executor;


public class WatcherHandler extends AbstractClientDataRequestHandler<ConfiguratorRegister> {

    @Autowired
    WatcherHandlerStrategy watcherHandlerStrategy;

    @Override
    public Object doHandle(Channel channel, ConfiguratorRegister message) {
        RegisterResponse result = new RegisterResponse();
        watcherHandlerStrategy.handleConfiguratorRegister(channel, message, result);
        return result;
    }

    @Override
    public Class interest() {
        return ConfiguratorRegister.class;
    }

    @Override
    public Executor getExecutor() {
        return executorManager.getAccessSubExecutor();
    }
}
